﻿//5. Write a method that checks if the element at given position in given array of integers is bigger than its two neighbors (when such exist).


using System;

class CompareNeighborsElementsInArray
{
    static void Main()
    {
        int position = int.Parse(Console.ReadLine());
        int[] arr = { 6, 4, 4, 2, 7, 7, 5, 9, 8, 3, 4, 7, 9, 4 };
        Console.WriteLine(CompareWhitNeighbors(arr, position - 1));
    }
    static bool CompareWhitNeighbors(int[] arr, int position)
    {
        if (position == 0 || position == arr.Length - 1)
        {
            if (position == 0 && arr[position] > arr[position + 1])
            {
                return true;
            }
            else if (position == arr.Length - 1 && arr[position] > arr[position - 1])
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        else if (arr[position] > arr[position - 1] && arr[position] > arr[position + 1])
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
